<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户登录</title>
        <link href="/Sites/AppRes/jquery_easyui/1.3.5/themes/default/easyui.css" rel="stylesheet" />   
	<style type="text/css">
    input { padding:5px;}
	td {padding:5px 0px 5px 10px;}
    </style>
        <script type="text/javascript" src="Sites/AppRes/Jquery/jquery-1.8.3.min.js"></script>
        <script type="text/javascript" src="Sites/AppRes/jquery_easyui/1.3.5/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="Sites/AppRes/jquery_center.js"></script>
</head>

<body>
<form id="fm" action="#" method="post">
    <div id="loginpanel" style="width:280px;">
    <div class="easyui-panel" title="用户登录">
<table cellpadding="0" cellspacing="0">
	<tr><td>用户名：</td><td><input type="text" name="UserName" /></td></tr>
        <tr><td>密 &nbsp;码：</td><td><input type="password" name="Password" /></td></tr>
        <tr><td colspan="2"><a href="#" class="easyui-linkbutton" id="submit">登录</a>
        <a href="#" class="easyui-linkbutton" id="reset">重置</a></td></tr>
</table>
</div>
        </div>
</form>
    <script type="text/javascript">
        $('.loginpanel').center({ relative: false });
        var apiurl='?m=Api/User';
        $('#submit').click(function(){
            $('#fm').form('submit',{
                url: apiurl+'&action=login&sa=1',
                onSubmit: function(){
                    return $(this).form('validate');
                },
                success: function(result){
                    var result = eval('('+result+')');
                    if (result.errorMsg){
                        $.messager.show({
                            title: 'Error',
                            msg: result.errorMsg
                        });
                    } else {
                        location.href='?m=Index.html';
                    }
                }
            });
        });
        $('#reset').click(function(){$('#fm')[0].reset();});
        </script>
</body>
</html>
